home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Time_Table2112785142008.psc / Test Time_Table / frmTimeTable.frm < prev   
Text File  |  2008-05-13  |  33KB  |  882 lines

  1. VERSION 5.00
  2. Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
  3. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  4. Begin VB.Form frmTimeTable 
  5.    BorderStyle     =   1  'Fixed Single
  6.    Caption         =   "Time Table"
  7.    ClientHeight    =   9540
  8.    ClientLeft      =   3210
  9.    ClientTop       =   1080
  10.    ClientWidth     =   9465
  11.    BeginProperty Font 
  12.       Name            =   "Verdana"
  13.       Size            =   8.25
  14.       Charset         =   0
  15.       Weight          =   400
  16.       Underline       =   0   'False
  17.       Italic          =   0   'False
  18.       Strikethrough   =   0   'False
  19.    EndProperty
  20.    LinkTopic       =   "Form1"
  21.    LockControls    =   -1  'True
  22.    MaxButton       =   0   'False
  23.    MinButton       =   0   'False
  24.    ScaleHeight     =   9540
  25.    ScaleWidth      =   9465
  26.    Begin VB.PictureBox Picture1 
  27.       BorderStyle     =   0  'None
  28.       Height          =   1215
  29.       Left            =   0
  30.       Picture         =   "frmTimeTable.frx":0000
  31.       ScaleHeight     =   1215
  32.       ScaleWidth      =   9495
  33.       TabIndex        =   27
  34.       Top             =   0
  35.       Width           =   9495
  36.    End
  37.    Begin VB.Frame Frame1 
  38.       Caption         =   "Time Table"
  39.       BeginProperty Font 
  40.          Name            =   "MS Sans Serif"
  41.          Size            =   8.25
  42.          Charset         =   0
  43.          Weight          =   400
  44.          Underline       =   0   'False
  45.          Italic          =   0   'False
  46.          Strikethrough   =   0   'False
  47.       EndProperty
  48.       Height          =   8295
  49.       Left            =   120
  50.       TabIndex        =   0
  51.       Top             =   1200
  52.       Width           =   9255
  53.       Begin MSComDlg.CommonDialog CommonDialog1 
  54.          Left            =   120
  55.          Top             =   2760
  56.          _ExtentX        =   847
  57.          _ExtentY        =   847
  58.          _Version        =   393216
  59.       End
  60.       Begin VB.CommandButton cmdDelete 
  61.          Caption         =   "&Delete Current Selected"
  62.          BeginProperty Font 
  63.             Name            =   "MS Sans Serif"
  64.             Size            =   8.25
  65.             Charset         =   0
  66.             Weight          =   400
  67.             Underline       =   0   'False
  68.             Italic          =   0   'False
  69.             Strikethrough   =   0   'False
  70.          EndProperty
  71.          Height          =   375
  72.          Left            =   6480
  73.          TabIndex        =   29
  74.          Top             =   1200
  75.          Width           =   2535
  76.       End
  77.       Begin MSFlexGridLib.MSFlexGrid MSFlxGrd_TT 
  78.          Height          =   4095
  79.          Left            =   120
  80.          TabIndex        =   28
  81.          Top             =   3360
  82.          Width           =   9015
  83.          _ExtentX        =   15901
  84.          _ExtentY        =   7223
  85.          _Version        =   393216
  86.          ForeColor       =   4194368
  87.          WordWrap        =   -1  'True
  88.          AllowUserResizing=   3
  89.          Appearance      =   0
  90.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  91.             Name            =   "Arial"
  92.             Size            =   9
  93.             Charset         =   0
  94.             Weight          =   700
  95.             Underline       =   0   'False
  96.             Italic          =   0   'False
  97.             Strikethrough   =   0   'False
  98.          EndProperty
  99.       End
  100.       Begin VB.CommandButton cmdClear 
  101.          Caption         =   "&Clear All"
  102.          BeginProperty Font 
  103.             Name            =   "MS Sans Serif"
  104.             Size            =   8.25
  105.             Charset         =   0
  106.             Weight          =   400
  107.             Underline       =   0   'False
  108.             Italic          =   0   'False
  109.             Strikethrough   =   0   'False
  110.          EndProperty
  111.          Height          =   375
  112.          Left            =   7920
  113.          TabIndex        =   25
  114.          Top             =   480
  115.          Width           =   1095
  116.       End
  117.       Begin VB.ListBox lst_Temp_Per_No 
  118.          BeginProperty Font 
  119.             Name            =   "MS Sans Serif"
  120.             Size            =   8.25
  121.             Charset         =   0
  122.             Weight          =   400
  123.             Underline       =   0   'False
  124.             Italic          =   0   'False
  125.             Strikethrough   =   0   'False
  126.          EndProperty
  127.          Height          =   645
  128.          Left            =   120
  129.          TabIndex        =   23
  130.          Top             =   7560
  131.          Width           =   975
  132.       End
  133.       Begin VB.ListBox lst_Temp_Teach_Sub 
  134.          BeginProperty Font 
  135.             Name            =   "MS Sans Serif"
  136.             Size            =   8.25
  137.             Charset         =   0
  138.             Weight          =   400
  139.             Underline       =   0   'False
  140.             Italic          =   0   'False
  141.             Strikethrough   =   0   'False
  142.          EndProperty
  143.          Height          =   645
  144.          Left            =   1080
  145.          TabIndex        =   24
  146.          Top             =   7560
  147.          Width           =   5175
  148.       End
  149.       Begin VB.TextBox Text1 
  150.          Alignment       =   1  'Right Justify
  151.          BeginProperty Font 
  152.             Name            =   "MS Sans Serif"
  153.             Size            =   8.25
  154.             Charset         =   0
  155.             Weight          =   400
  156.             Underline       =   0   'False
  157.             Italic          =   0   'False
  158.             Strikethrough   =   0   'False
  159.          EndProperty
  160.          Height          =   300
  161.          Left            =   2280
  162.          TabIndex        =   21
  163.          Top             =   2400
  164.          Visible         =   0   'False
  165.          Width           =   735
  166.       End
  167.       Begin VB.ListBox lstP 
  168.          Appearance      =   0  'Flat
  169.          BackColor       =   &H00000000&
  170.          BeginProperty Font 
  171.             Name            =   "Garamond"
  172.             Size            =   8.25
  173.             Charset         =   0
  174.             Weight          =   700
  175.             Underline       =   0   'False
  176.             Italic          =   0   'False
  177.             Strikethrough   =   0   'False
  178.          EndProperty
  179.          ForeColor       =   &H0000FF00&
  180.          Height          =   930
  181.          Left            =   4440
  182.          TabIndex        =   19
  183.          Top             =   1200
  184.          Width           =   1215
  185.       End
  186.       Begin VB.ListBox lstCl 
  187.          Appearance      =   0  'Flat
  188.          BackColor       =   &H00000000&
  189.          BeginProperty Font 
  190.             Name            =   "Garamond"
  191.             Size            =   8.25
  192.             Charset         =   0
  193.             Weight          =   700
  194.             Underline       =   0   'False
  195.             Italic          =   0   'False
  196.             Strikethrough   =   0   'False
  197.          EndProperty
  198.          ForeColor       =   &H0000FF00&
  199.          Height          =   930
  200.          Left            =   3480
  201.          TabIndex        =   18
  202.          Top             =   1200
  203.          Width           =   735
  204.       End
  205.       Begin VB.ListBox lstS 
  206.          Appearance      =   0  'Flat
  207.          BackColor       =   &H00000000&
  208.          BeginProperty Font 
  209.             Name            =   "Garamond"
  210.             Size            =   8.25
  211.             Charset         =   0
  212.             Weight          =   700
  213.             Underline       =   0   'False
  214.             Italic          =   0   'False
  215.             Strikethrough   =   0   'False
  216.          EndProperty
  217.          ForeColor       =   &H0000FF00&
  218.          Height          =   930
  219.          Left            =   2040
  220.          TabIndex        =   17
  221.          Top             =   1200
  222.          Width           =   1335
  223.       End
  224.       Begin VB.ListBox lstN 
  225.          Appearance      =   0  'Flat
  226.          BackColor       =   &H00000000&
  227.          BeginProperty Font 
  228.             Name            =   "Garamond"
  229.             Size            =   8.25
  230.             Charset         =   0
  231.             Weight          =   700
  232.             Underline       =   0   'False
  233.             Italic          =   0   'False
  234.             Strikethrough   =   0   'False
  235.          EndProperty
  236.          ForeColor       =   &H0000FF00&
  237.          Height          =   930
  238.          Left            =   120
  239.          TabIndex        =   16
  240.          Top             =   1200
  241.          Width           =   1815
  242.       End
  243.       Begin VB.CommandButton cmdExcl 
  244.          Caption         =   "&Send to MS-Excel for Printing"
  245.          BeginProperty Font 
  246.             Name            =   "MS Sans Serif"
  247.             Size            =   8.25
  248.             Charset         =   0
  249.             Weight          =   400
  250.             Underline       =   0   'False
  251.             Italic          =   0   'False
  252.             Strikethrough   =   0   'False
  253.          EndProperty
  254.          Height          =   375
  255.          Left            =   6360
  256.          TabIndex        =   15
  257.          Top             =   7850
  258.          Width           =   2775
  259.       End
  260.       Begin VB.CommandButton cmdGen 
  261.          Caption         =   "&Generate the Time-table"
  262.          BeginProperty Font 
  263.             Name            =   "MS Sans Serif"
  264.             Size            =   8.25
  265.             Charset         =   0
  266.             Weight          =   400
  267.             Underline       =   0   'False
  268.             Italic          =   0   'False
  269.             Strikethrough   =   0   'False
  270.          EndProperty
  271.          Height          =   375
  272.          Left            =   3480
  273.          TabIndex        =   14
  274.          Top             =   2950
  275.          Width           =   2055
  276.       End
  277.       Begin VB.VScrollBar VScrl_Tot 
  278.          Height          =   375
  279.          Left            =   8400
  280.          Max             =   6000
  281.          Min             =   1
  282.          TabIndex        =   13
  283.          Top             =   2350
  284.          Value           =   1
  285.          Width           =   375
  286.       End
  287.       Begin VB.TextBox txttot_periods 
  288.          Alignment       =   1  'Right Justify
  289.          BeginProperty Font 
  290.             Name            =   "MS Sans Serif"
  291.             Size            =   8.25
  292.             Charset         =   0
  293.             Weight          =   400
  294.             Underline       =   0   'False
  295.             Italic          =   0   'False
  296.             Strikethrough   =   0   'False
  297.          EndProperty
  298.          Height          =   300
  299.          Left            =   7680
  300.          TabIndex        =   12
  301.          Top             =   2400
  302.          Width           =   735
  303.       End
  304.       Begin VB.CommandButton cmdAdd 
  305.          Caption         =   "&Add to List"
  306.          BeginProperty Font 
  307.             Name            =   "MS Sans Serif"
  308.             Size            =   8.25
  309.             Charset         =   0
  310.             Weight          =   400
  311.             Underline       =   0   'False
  312.             Italic          =   0   'False
  313.             Strikethrough   =   0   'False
  314.          EndProperty
  315.          Height          =   375
  316.          Left            =   6480
  317.          TabIndex        =   10
  318.          Top             =   480
  319.          Width           =   1095
  320.       End
  321.       Begin VB.VScrollBar VScrl_Peri 
  322.          Height          =   375
  323.          Left            =   5205
  324.          Max             =   25
  325.          Min             =   1
  326.          TabIndex        =   9
  327.          Top             =   465
  328.          Value           =   1
  329.          Width           =   375
  330.       End
  331.       Begin VB.TextBox txtPeriods 
  332.          Alignment       =   1  'Right Justify
  333.          BeginProperty Font 
  334.             Name            =   "MS Sans Serif"
  335.             Size            =   8.25
  336.             Charset         =   0
  337.             Weight          =   400
  338.             Underline       =   0   'False
  339.             Italic          =   0   'False
  340.             Strikethrough   =   0   'False
  341.          EndProperty
  342.          Height          =   300
  343.          Left            =   4560
  344.          TabIndex        =   8
  345.          Top             =   480
  346.          Width           =   615
  347.       End
  348.       Begin VB.TextBox txtCls 
  349.          BeginProperty Font 
  350.             Name            =   "MS Sans Serif"
  351.             Size            =   8.25
  352.             Charset         =   0
  353.             Weight          =   400
  354.             Underline       =   0   'False
  355.             Italic          =   0   'False
  356.             Strikethrough   =   0   'False
  357.          EndProperty
  358.          Height          =   300
  359.          Left            =   3480
  360.          TabIndex        =   6
  361.          Top             =   480
  362.          Width           =   735
  363.       End
  364.       Begin VB.ComboBox cmbSub 
  365.          BeginProperty Font 
  366.             Name            =   "MS Sans Serif"
  367.             Size            =   8.25
  368.             Charset         =   0
  369.             Weight          =   400
  370.             Underline       =   0   'False
  371.             Italic          =   0   'False
  372.             Strikethrough   =   0   'False
  373.          EndProperty
  374.          Height          =   315
  375.          ItemData        =   "frmTimeTable.frx":29406
  376.          Left            =   2040
  377.          List            =   "frmTimeTable.frx":29422
  378.          TabIndex        =   4
  379.          Top             =   480
  380.          Width           =   1335
  381.       End
  382.       Begin VB.ComboBox cmbTeacher 
  383.          BeginProperty Font 
  384.             Name            =   "MS Sans Serif"
  385.             Size            =   8.25
  386.             Charset         =   0
  387.             Weight          =   400
  388.             Underline       =   0   'False
  389.             Italic          =   0   'False
  390.             Strikethrough   =   0   'False
  391.          EndProperty
  392.          Height          =   315
  393.          ItemData        =   "frmTimeTable.frx":29472
  394.          Left            =   120
  395.          List            =   "frmTimeTable.frx":2948E
  396.          TabIndex        =   2
  397.          Top             =   480
  398.          Width           =   1815
  399.       End
  400.       Begin VB.Label Label6 
  401.          Alignment       =   1  'Right Justify
  402.          Caption         =   "Total Periods:"
  403.          BeginProperty Font 
  404.             Name            =   "MS Sans Serif"
  405.             Size            =   8.25
  406.             Charset         =   0
  407.             Weight          =   400
  408.             Underline       =   0   'False
  409.             Italic          =   0   'False
  410.             Strikethrough   =   0   'False
  411.          EndProperty
  412.          Height          =   255
  413.          Left            =   6960
  414.          TabIndex        =   26
  415.          Top             =   1920
  416.          Width           =   1095
  417.       End
  418.       Begin VB.Line Line3 
  419.          BorderWidth     =   2
  420.          X1              =   0
  421.          X2              =   9240
  422.          Y1              =   1080
  423.          Y2              =   1080
  424.       End
  425.       Begin VB.Label Label8 
  426.          Caption         =   "Patterns/Groups :"
  427.          BeginProperty Font 
  428.             Name            =   "MS Sans Serif"
  429.             Size            =   12
  430.             Charset         =   0
  431.             Weight          =   700
  432.             Underline       =   0   'False
  433.             Italic          =   0   'False
  434.             Strikethrough   =   0   'False
  435.          EndProperty
  436.          Height          =   375
  437.          Left            =   120
  438.          TabIndex        =   22
  439.          Top             =   2400
  440.          Visible         =   0   'False
  441.          Width           =   2175
  442.       End
  443.       Begin VB.Label Label7 
  444.          Alignment       =   1  'Right Justify
  445.          Caption         =   "-"
  446.          BeginProperty Font 
  447.             Name            =   "MS Sans Serif"
  448.             Size            =   8.25
  449.             Charset         =   0
  450.             Weight          =   400
  451.             Underline       =   0   'False
  452.             Italic          =   0   'False
  453.             Strikethrough   =   0   'False
  454.          EndProperty
  455.          Height          =   255
  456.          Left            =   8160
  457.          TabIndex        =   20
  458.          Top             =   1920
  459.          Width           =   855
  460.       End
  461.       Begin VB.Line Line1 
  462.          BorderWidth     =   2
  463.          X1              =   0
  464.          X2              =   9240
  465.          Y1              =   2880
  466.          Y2              =   2880
  467.       End
  468.       Begin VB.Label Label1 
  469.          Caption         =   "Total No. of Periods per day:"
  470.          BeginProperty Font 
  471.             Name            =   "MS Sans Serif"
  472.             Size            =   12
  473.             Charset         =   0
  474.             Weight          =   700
  475.             Underline       =   0   'False
  476.             Italic          =   0   'False
  477.             Strikethrough   =   0   'False
  478.          EndProperty
  479.          Height          =   375
  480.          Left            =   4200
  481.          TabIndex        =   11
  482.          Top             =   2400
  483.          Width           =   3495
  484.       End
  485.       Begin VB.Line Line2 
  486.          BorderWidth     =   2
  487.          X1              =   0
  488.          X2              =   9240
  489.          Y1              =   2280
  490.          Y2              =   2280
  491.       End
  492.       Begin VB.Label Label5 
  493.          BorderStyle     =   1  'Fixed Single
  494.          Caption         =   "No of Periods in a Week"
  495.          BeginProperty Font 
  496.             Name            =   "MS Sans Serif"
  497.             Size            =   8.25
  498.             Charset         =   0
  499.             Weight          =   400
  500.             Underline       =   0   'False
  501.             Italic          =   0   'False
  502.             Strikethrough   =   0   'False
  503.          EndProperty
  504.          Height          =   255
  505.          Left            =   4380
  506.          TabIndex        =   7
  507.          Top             =   240
  508.          Width           =   1815
  509.       End
  510.       Begin VB.Label Label4 
  511.          BorderStyle     =   1  'Fixed Single
  512.          Caption         =   "Class-Div"
  513.          BeginProperty Font 
  514.             Name            =   "MS Sans Serif"
  515.             Size            =   8.25
  516.             Charset         =   0
  517.             Weight          =   400
  518.             Underline       =   0   'False
  519.             Italic          =   0   'False
  520.             Strikethrough   =   0   'False
  521.          EndProperty
  522.          Height          =   255
  523.          Left            =   3480
  524.          TabIndex        =   5
  525.          Top             =   240
  526.          Width           =   855
  527.       End
  528.       Begin VB.Label Label3 
  529.          BorderStyle     =   1  'Fixed Single
  530.          Caption         =   "Subject taught"
  531.          BeginProperty Font 
  532.             Name            =   "MS Sans Serif"
  533.             Size            =   8.25
  534.             Charset         =   0
  535.             Weight          =   400
  536.             Underline       =   0   'False
  537.             Italic          =   0   'False
  538.             Strikethrough   =   0   'False
  539.          EndProperty
  540.          Height          =   255
  541.          Left            =   2160
  542.          TabIndex        =   3
  543.          Top             =   240
  544.          Width           =   1155
  545.       End
  546.       Begin VB.Label Label2 
  547.          BorderStyle     =   1  'Fixed Single
  548.          Caption         =   "Teachers Name"
  549.          BeginProperty Font 
  550.             Name            =   "MS Sans Serif"
  551.             Size            =   8.25
  552.             Charset         =   0
  553.             Weight          =   400
  554.             Underline       =   0   'False
  555.             Italic          =   0   'False
  556.             Strikethrough   =   0   'False
  557.          EndProperty
  558.          Height          =   255
  559.          Left            =   120
  560.          TabIndex        =   1
  561.          Top             =   240
  562.          Width           =   1335
  563.       End
  564.    End
  565. End
  566. Attribute VB_Name = "frmTimeTable"
  567. Attribute VB_GlobalNameSpace = False
  568. Attribute VB_Creatable = False
  569. Attribute VB_PredeclaredId = True
  570. Attribute VB_Exposed = False
  571. Option Explicit
  572.  
  573. Dim Collect_Period As Collection, Collect_Teach_Sub As Collection
  574. Dim to_Add As Boolean, Added As Boolean
  575. Dim lstR As Integer, lstC As Integer
  576.  
  577. Private Sub cmdAdd_Click()
  578. Me.lstN.AddItem Me.cmbTeacher.Text
  579. Me.lstS.AddItem Me.cmbSub.Text
  580. Me.lstCl.AddItem Me.txtCls.Text
  581. Me.lstP.AddItem Me.txtPeriods.Text
  582. 'Me.lstD.AddItem Me.txtdays.Text
  583. If Me.Label7.Caption = "-" Then
  584.     Me.Label7.Caption = Me.txtPeriods.Text
  585. Else
  586.     Me.Label7.Caption = CInt(Me.Label7.Caption) + CInt(Me.txtPeriods.Text)
  587. End If
  588. End Sub
  589.  
  590. Private Sub cmdClear_Click()
  591. Me.lst_Temp_Per_No.Clear
  592. Me.lst_Temp_Teach_Sub.Clear
  593. Me.lstCl.Clear
  594. Me.lstN.Clear
  595. Me.lstP.Clear
  596. Me.lstS.Clear
  597. Me.MSFlxGrd_TT.Clear
  598. Me.Label7.Caption = "-"
  599. Me.txttot_periods.Text = ""
  600. End Sub
  601.  
  602. Private Sub cmdDelete_Click()
  603. Dim ind As Integer
  604. ind = Me.lstN.ListIndex
  605. Me.lstN.RemoveItem ind
  606. Me.lstCl.RemoveItem ind
  607. Me.lstP.RemoveItem ind
  608. Me.lstS.RemoveItem ind
  609. If Me.Label7.Caption = "-" Then
  610.     Me.Label7.Caption = Me.txtPeriods.Text
  611. Else
  612.     Me.Label7.Caption = CInt(Me.Label7.Caption) - CInt(Me.txtPeriods.Text)
  613. End If
  614.  
  615. End Sub
  616.  
  617. Private Sub cmdExcl_Click()
  618. 'Define the required variable
  619. Dim Data_Row As Integer, Data_Col As Integer
  620.  
  621. Dim Excel As Excel.Application ' This is the excel program
  622. Dim ExcelWBk As Excel.Workbook ' This is the work book
  623. Dim ExcelWS As Excel.Worksheet ' This is the sheet
  624.  
  625. If Not Excel Is Nothing Then Set Excel = Nothing
  626. Set Excel = CreateObject("Excel.Application") 'Create Excel Object.
  627.  
  628. Set ExcelWBk = Excel.Workbooks.Add 'Add this Workbook to Excel.
  629. Set ExcelWS = ExcelWBk.Worksheets(1) ' Add this sheet to this Workbook
  630.  
  631. 'Fill the Excel Sheet
  632. For Data_Row = 0 To Me.MSFlxGrd_TT.Rows - 1
  633.     For Data_Col = 1 To Me.MSFlxGrd_TT.Cols - 1
  634.         Me.MSFlxGrd_TT.Row = Data_Row
  635.         Me.MSFlxGrd_TT.Col = Data_Col
  636.         ExcelWS.Cells(Data_Row + 1, Data_Col) = Me.MSFlxGrd_TT.Text
  637.     Next
  638. Next
  639. Me.CommonDialog1.ShowSave
  640. If Len(Me.CommonDialog1.FileName) > 0 Then ExcelWBk.SaveAs Me.CommonDialog1.FileName
  641. ' Close the WorkBook
  642. ExcelWBk.Close
  643. ' Quit Excel app
  644. Excel.Quit
  645. Set Excel = Nothing
  646. End Sub
  647.  
  648. Private Sub cmdGen_Click()
  649. Dim start_Val  As Integer, tot_peri_dys As Integer
  650. Dim no_peri As Integer, filler As Integer
  651.  
  652. Me.lst_Temp_Per_No.Clear
  653. Me.lst_Temp_Teach_Sub.Clear
  654.  
  655. Set Collect_Period = New Collection
  656. Set Collect_Teach_Sub = New Collection
  657.  
  658. If Len(Me.txttot_periods.Text) > 0 Then
  659.     tot_peri_dys = CInt(Me.txttot_periods.Text)
  660. Else
  661.     Exit Sub
  662. End If
  663.  
  664. If CInt(Me.Label7.Caption) > ((tot_peri_dys * 6)) * _
  665. ((Me.lstN.ListCount - 1) / (Me.cmbTeacher.ListCount - 1)) Then
  666.     If MsgBox("The machine may hang while designing," & vbCrLf & "Do you want to continue?", vbCritical + vbOKCancel, "Problem...") = vbOK Then
  667.         'Nothing much to do
  668.         'Try to design the Time-table
  669.         'If mach. hangs its not the prog. problem.
  670.     Else
  671.         MsgBox "Try increasing the no of periods in a week, and click again.", , "Problem..."
  672.         Exit Sub
  673.     End If
  674. End If
  675.  
  676.  
  677. 'Start Enumerating through the list
  678. For start_Val = 0 To lstN.ListCount - 1
  679.     lstN.ListIndex = start_Val
  680.     lstCl.ListIndex = start_Val
  681.     lstS.ListIndex = start_Val
  682.     lstP.ListIndex = start_Val
  683.     
  684.     Fill_Collection tot_peri_dys, lstN.Text & " " & lstCl.Text & " " & lstS.Text, CInt(lstP.Text)
  685. Next
  686.  
  687. Dim c As Integer, t As Integer
  688.  
  689. Me.MSFlxGrd_TT.Clear
  690. Me.MSFlxGrd_TT.Rows = tot_peri_dys + 1
  691. Me.MSFlxGrd_TT.Cols = 7
  692. 'Marks the Periods
  693. For c = 1 To tot_peri_dys
  694.     Me.MSFlxGrd_TT.Row = c
  695.     Me.MSFlxGrd_TT.Col = 0
  696.     Me.MSFlxGrd_TT.Text = "# " & c
  697. Next
  698. 'Fill the FlexGrid with the Weekdays.
  699. 'Monday
  700. Me.MSFlxGrd_TT.Row = 0
  701. Me.MSFlxGrd_TT.Col = 1
  702. Me.MSFlxGrd_TT.Text = "Monday"
  703. 'Tuesday
  704. Me.MSFlxGrd_TT.Row = 0
  705. Me.MSFlxGrd_TT.Col = 2
  706. Me.MSFlxGrd_TT.Text = "Tueday"
  707. 'Wednesday
  708. Me.MSFlxGrd_TT.Row = 0
  709. Me.MSFlxGrd_TT.Col = 3
  710. Me.MSFlxGrd_TT.Text = "Wednesday"
  711. 'Thursday
  712. Me.MSFlxGrd_TT.Row = 0
  713. Me.MSFlxGrd_TT.Col = 4
  714. Me.MSFlxGrd_TT.Text = "Thursday"
  715. 'Friday
  716. Me.MSFlxGrd_TT.Row = 0
  717. Me.MSFlxGrd_TT.Col = 5
  718. Me.MSFlxGrd_TT.Text = "Friday"
  719. 'Saturday
  720. Me.MSFlxGrd_TT.Row = 0
  721. Me.MSFlxGrd_TT.Col = 6
  722. Me.MSFlxGrd_TT.Text = "Saturday"
  723.  
  724. 'For filler = 1 To Collect_Period.Count
  725. '
  726. '    For c = 1 To (tot_peri_dys * 6) Step 6
  727. '        If Collect_Period.Item(filler) >= c And Collect_Period.Item(filler) <= (c + 5) Then
  728. '            Me.MSFlxGrd_TT.Row = (c + 5) \ 6
  729. '            Me.MSFlxGrd_TT.Col = Collect_Period.Item(filler) Mod 6 + 1
  730. '            Me.MSFlxGrd_TT.Text = Collect_Teach_Sub.Item(filler)
  731. '        End If
  732. '        If CInt(Me.lst_Temp_Per_No.List(filler)) >= c And CInt(Me.lst_Temp_Per_No.List(filler)) <= (c + 5) Then
  733. '            Me.MSFlxGrd_TT.Row = (c + 5) \ 6
  734. '            Me.MSFlxGrd_TT.Col = CInt(Me.lst_Temp_Per_No.List(filler)) Mod 6 + 1
  735. '            Me.MSFlxGrd_TT.Text = Me.lst_Temp_Teach_Sub.List(filler)
  736. '        End If
  737. '
  738. '
  739. '    Next
  740. 'Next
  741.  
  742. For filler = 0 To CInt(Me.lst_Temp_Per_No.ListCount) - 1
  743.     For c = 1 To (tot_peri_dys * 6) Step 6
  744.         If CInt(Me.lst_Temp_Per_No.List(filler)) >= c And CInt(Me.lst_Temp_Per_No.List(filler)) <= (c + 5) Then
  745.             Me.MSFlxGrd_TT.Row = (c + 5) \ 6
  746.             Me.MSFlxGrd_TT.Col = CInt(Me.lst_Temp_Per_No.List(filler)) Mod 6 + 1
  747.             Me.MSFlxGrd_TT.Text = Me.lst_Temp_Teach_Sub.List(filler)
  748.         End If
  749.     Next
  750.  
  751.     
  752. '    If Collect_Period.Item(filler) >= 1 And Collect_Period.Item(filler) <= 6 Then
  753. '        Me.MSFlxGrd_TT.Row = 1
  754. '        Me.MSFlxGrd_TT.Col = Collect_Period.Item(filler) Mod 6 + 1
  755. '        Me.MSFlxGrd_TT.Text = Collect_Teach_Sub.Item(filler)
  756. '    ElseIf Collect_Period.Item(filler) >= 7 And Collect_Period.Item(filler) <= 12 Then
  757. '        Me.MSFlxGrd_TT.Row = 2
  758. '        Me.MSFlxGrd_TT.Col = Collect_Period.Item(filler) Mod 6 + 1
  759. '        Me.MSFlxGrd_TT.Text = Collect_Teach_Sub.Item(filler)
  760. '    ElseIf Collect_Period.Item(filler) >= 13 And Collect_Period.Item(filler) <= 18 Then
  761. '        Me.MSFlxGrd_TT.Row = 3
  762. '        Me.MSFlxGrd_TT.Col = Collect_Period.Item(filler) Mod 6 + 1
  763. '        Me.MSFlxGrd_TT.Text = Collect_Teach_Sub.Item(filler)
  764. '    ElseIf Collect_Period.Item(filler) >= 19 And Collect_Period.Item(filler) <= 24 Then
  765. '        Me.MSFlxGrd_TT.Row = 4
  766. '        Me.MSFlxGrd_TT.Col = Collect_Period.Item(filler) Mod 6 + 1
  767. '        Me.MSFlxGrd_TT.Text = Collect_Teach_Sub.Item(filler)
  768. '    ElseIf Collect_Period.Item(filler) >= 25 And Collect_Period.Item(filler) <= 30 Then
  769. '        Me.MSFlxGrd_TT.Row = 5
  770. '        Me.MSFlxGrd_TT.Col = Collect_Period.Item(filler) Mod 6 + 1
  771. '        Me.MSFlxGrd_TT.Text = Collect_Teach_Sub.Item(filler)
  772. '    ElseIf Collect_Period.Item(filler) >= 31 And Collect_Period.Item(filler) <= 36 Then
  773. '        Me.MSFlxGrd_TT.Row = 6
  774. '        Me.MSFlxGrd_TT.Col = Collect_Period.Item(filler) Mod 6 + 1
  775. '        Me.MSFlxGrd_TT.Text = Collect_Teach_Sub.Item(filler)
  776. '    ElseIf Collect_Period.Item(filler) >= 37 And Collect_Period.Item(filler) <= 42 Then
  777. '        Me.MSFlxGrd_TT.Row = 7
  778. '        Me.MSFlxGrd_TT.Col = Collect_Period.Item(filler) Mod 6 + 1
  779. '        Me.MSFlxGrd_TT.Text = Collect_Teach_Sub.Item(filler)
  780. '    ElseIf Collect_Period.Item(filler) >= 43 And Collect_Period.Item(filler) <= 48 Then
  781. '        Me.MSFlxGrd_TT.Row = 8
  782. '        Me.MSFlxGrd_TT.Col = Collect_Period.Item(filler) Mod 6 + 1
  783. '        Me.MSFlxGrd_TT.Text = Collect_Teach_Sub.Item(filler)
  784. '    End If
  785. Next
  786.  
  787. Set Collect_Period = Nothing
  788. Set Collect_Teach_Sub = Nothing
  789. End Sub
  790.  
  791. 'Creates the Collection and list.
  792.  
  793. Private Sub Fill_Collection(tot_peri_dys As Integer, s As String, no_peri As Integer)
  794. Dim i As Integer, Tot_Periods As Integer, pos As Integer
  795. Dim flag As Boolean, j As Integer
  796. Tot_Periods = 6 * tot_peri_dys
  797. to_Add = True
  798.  
  799. For i = 0 To no_peri - 1
  800.     If Collect_Period.Count > 0 Then
  801.         pos = GetPos(Tot_Periods)
  802.         Do While 1
  803.             If NoDuplicate(pos, s) Then
  804.                 Collect_Period.Add pos
  805.                 Collect_Teach_Sub.Add s
  806.                 If Added = False Then
  807.                     If to_Add = True Then
  808.                         Me.lst_Temp_Per_No.AddItem pos
  809.                         Me.lst_Temp_Teach_Sub.AddItem s
  810.                         to_Add = False
  811.                     End If
  812.                 End If
  813.                 Exit Do
  814.             Else
  815.                  If Added = True Then Exit Do
  816.                  pos = GetPos(Tot_Periods)
  817.             End If
  818.         Loop
  819.     Else
  820.         pos = GetPos(Tot_Periods)
  821.         If pos <> 0 Then
  822.             Collect_Period.Add pos
  823.             Collect_Teach_Sub.Add s
  824.             Me.lst_Temp_Per_No.AddItem pos
  825.             Me.lst_Temp_Teach_Sub.AddItem s
  826.         End If
  827.     End If
  828.     Added = False
  829. Next
  830.  
  831. End Sub
  832.  
  833. 'The No Duplication function prevents duplication of values, selected @ random.
  834. Private Function NoDuplicate(N As Integer, CL_Sub As String) As Boolean
  835.     Dim i As Integer, flag As Boolean, temp As Integer, garb As String
  836.     Dim ext, function prevents dF4l           1ndllBar VScrl_Tot 
  837.          Height          =   375
  838.   1nT.AddItem pos
  839.             Me.lst_Temp_     
  840.  edIt   Blect_Teach_Sub.Add s
  841.             Me.lst_Temp_Per_No.AddItem pos
  842.             Me.lst_Temp_Teach_Sub.AddItem s
  843.         End If
  844.     End If     Me.lst_Temp_Per_2a
  845.      d If
  846.     Ad    Item poemp_Per   EeU2F_Temp_Per_2a
  847.      d2   Me.lst_Temp    6   ElseIf CollI0     Me.lst_1dSa    " 6   Ela    " 6   Ela241mp   Ela    " .l ion prevents dFnd I91T_Sriod.Item(filler) <= 30 Then
  848. uTx69.Item(filol = CollecGion -69r  <= 30 Then
  849. uTx6otem s
  850.      ElseAT.AddCThen
  851. '        Me.-69rP Me.-69rP Me.-pos
  852.             Me.lst_Temp_Teac   If shP  Ela    "         As Boolean, temp As IntegePxGrd_TT.Row = Gler) >= 31 And sTAPxGrd_TT.Rem8 Integer, CL_Sub As String) As Bo68mgePxGrl4Do
  853.             Me.lst_Temp_Teac   If shP  ElP.AddItem Me.ti   AddItem pos
  854.                    _TeHC End If     Me.lst_Tebser, CL_Sub As StringGsaMPhe WorkBookPxGrl4Do
  855.             Me.lst_Temp_ngGsaMPhe WorGsaMPhe WorkBookPxGrl4Do
  856.             Me.lst_Temp_ngGsaMPhe WorGsaMPhe WorkBookPxGrl4Do
  857.             Me.lst_Temp_ngGsaMPhe WorGsaMPhe WorkBookPxGrl4Do
  858.             Me.lst_Temp_ngGsaMPhe WorGsaMPhe WorkBookPxGrl4Do
  859.             Me.lst_Temp_ngGsaMPhe WorGsaMPhe Wotmi, CLVScrl-e05i1    Me.lst_Temp_ngGsaMPhe WorGsaMPTemp_TeacaaD4e WoddCThe
  860. AtCttttt9x9F9Temp_ngGsaMPhe WorGsaMPhe WorkBookPxGrl4Do
  861.             Me.lst_Tempg
  862. '            Me.MSFlxGrd_TT.Text = Me.llst_Tempg
  863. '            Me.MSFlxest_Tem.StringGsaMPhe WorkBookPxGrl4Do
  864.       MSFlxest_Tem.StringGsaMPhe WorkBookPxem.StringGsaMPhe WorkBookPxem.StringGsach_Sub.Item(filler)C(fil2_ngGfer, CL_Sub As Stn
  865.   De.3t_Temp_Per_No.List( AsngGrkBookPxem.StringGsach_Suil2_ngGfer, CL_Sub    MfnMPhe WorkBookPxGrl4koller)
  866. '    ElseIf Col3Vo0   achR8_SuborkdPer_2a
  867.      d If
  868.     Ad d_TT.Text = Collect_Teach_Sub.mp_ngGsaMPhe WorGsaMPhe WoringGsaMPhe WorkBookPxem.StringGsach_Suub.Item(filler)C(fil2_ngGfer, CL_Sub As Stn
  869.   De.3t_Temp_Per_No.List( AsngGrkBookPxem.StringGsach_Suil2_ngGfer, CL_Sub    MfnMPhe WorkBookPxGrl4koller)
  870. '    ElseIf Col3Vo0   achR8_SuborkdPer_2a
  871.      d If
  872.     Ad d_TT.Text = Collect_Teach_Sub.mp_ngGsaMPhe WoWoringGsaMPhe WorkBookPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1ghen
  873. "vMe.lst_Temp_Per_Phe WorGsataMPhe WoWoringGsaMPhe WorkBookPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1ghen
  874. "vMe.lst_Temp_Per_Phe WorGsataMPhe WoWoringGsaMPhe.mp_ng2o              5ller)
  875. ' keat n As SuokPxPx4DWt9g1g2o              5ller)
  876. ' keat n FlxGler)
  877. ' keatp2okPxPx4DWt9g1ghen
  878. "vMe.lst_Te iug2o  s SuokPxPx4DWt9g1g2o p2okPxRsi9Temp_ngGsaMPhe WorGseIf Col3V8e    ElseI_ngGsaoorG  Ad d_TT.Text = Collect_Teach_Sub.mp_ngGsaMPhe WoWoringGsaMPhe WorkBookPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p1g_p1g_p1g_p1gWt9gr6SAs Stn
  879.   De.3t_Temp_Per_No.List( AsngGrkBookPxem.StringGsach_Suil2_ngGfer, CL_Sub    MfnMPhe WorkBookPxGrl4koller)
  880. '    Elsing5_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1g_p2okPxPx4DWt9g1ghen
  881. "vMe.lst_Temp_Per_Phe WorGsataMPhe WoWoringGsaMPhe.mp_ng2o              5ller)
  882. ' keat n As SuokPxP